package com.taobao.txc.client;

import com.taobao.txc.common.LoggerInit;
import com.taobao.txc.common.LoggerWrap;
import com.taobao.txc.common.config.o;
import com.taobao.txc.resourcemanager.a.f;
import com.taobao.txc.resourcemanager.j;
import com.taobao.txc.resourcemanager.k;
import com.taobao.txc.resourcemanager.mt.MtResourceManager;
import java.io.PrintStream;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy;
import java.util.concurrent.TimeUnit;

public class a
{
  private static final LoggerWrap b = LoggerInit.logger;
  private static a c = null;
  private String d;
  private String e;
  private com.taobao.txc.client.a.a f = null;
  private com.taobao.txc.a.b.g g;
  public final ThreadPoolExecutor a = new ThreadPoolExecutor(32, 200, 500L, TimeUnit.SECONDS, new LinkedBlockingQueue(20000), new ThreadPoolExecutor.CallerRunsPolicy());
  
  public static a a(String paramString1, String paramString2, int paramInt)
  {
    return a(paramString1, paramString2, paramInt, new HashSet(), null, null, 0);
  }
  
  public static a a(String paramString1, String paramString2, int paramInt1, Set<String> paramSet, String paramString3, String paramString4, int paramInt2)
  {
    if (c == null) {
      synchronized (a.class)
      {
        if (c == null) {
          c = new a(paramString1, paramString2, paramInt1, paramSet, paramString3, paramString4, paramInt2);
        }
      }
    }
    return c;
  }
  
  private a(String paramString1, String paramString2, int paramInt1, Set<String> paramSet, String paramString3, String paramString4, int paramInt2)
  {
    if (System.getProperty("txc.appname") != null) {
      paramString1 = System.getProperty("txc.appname");
    }
    if (System.getProperty("txc.servergroup") != null) {
      paramString2 = System.getProperty("txc.servergroup");
    }
    if (System.getProperty("txc.mode") != null) {
      paramInt1 = Integer.parseInt(System.getProperty("txc.mode"));
    }
    this.d = paramString3;
    this.e = paramString4;
    a(paramString1, paramString2, paramInt1, paramSet, paramInt2);
  }
  
  public void a(String paramString1, String paramString2, int paramInt1, Set<String> paramSet, int paramInt2)
  {
    System.out.println("client mode:" + paramInt1 + " [0:None (only be client) 1:Default Mode 2:Manual Mode 3:Default Mode & Manual Mode 5:Default Mode & Service Mode 6:Manual Mode & Service Mode 7:Default Mode & Manual Mode &Service Mode]");
    System.out.println("txcAppName:" + paramString1);
    System.out.println("txcServerGroup:" + paramString2);
    if (com.taobao.txc.common.config.i.d == null) {
      if (paramInt2 == 0) {
        o.a(true);
      } else {
        com.taobao.txc.common.config.i.b();
      }
    }
    o.a(paramString2);
    if ((0x4 & paramInt1) == 0)
    {
      com.taobao.txc.common.g.a = com.taobao.txc.common.i.b;
      this.g = com.taobao.txc.a.b.g.a(this.a);
      this.g.h(paramString2);
      this.g.a(paramString1);
      this.g.a(paramInt2);
      this.g.a(paramSet);
      this.g.f(b());
      this.g.g(c());
      this.g.b();
      b.info("RpcClient inited. client mode:" + paramInt1 + " txcAppName:" + paramString1 + " txcServerGroup:" + paramString2);
      localObject1 = com.taobao.txc.client.a.a.a.c();
      ((com.taobao.txc.client.a.a.a)localObject1).a(this.g);
      ((com.taobao.txc.client.a.a.a)localObject1).d();
      this.f = ((com.taobao.txc.client.a.a)localObject1);
      b.info("TxcTransactionManager inited");
      o.a().a("txc.dummy", paramString1, new b(this));
    }
    else
    {
      com.taobao.txc.common.g.a = com.taobao.txc.common.i.c;
    }
    b.info("txc role is:" + com.taobao.txc.common.g.a);
    Object localObject1 = null;
    Object localObject2;
    Object localObject3;
    if ((0x1 & paramInt1) > 0)
    {
      localObject2 = com.taobao.txc.resourcemanager.c.a(this.a);
      ((com.taobao.txc.resourcemanager.c)localObject2).d(paramString1);
      ((com.taobao.txc.resourcemanager.c)localObject2).b();
      b.info("RmRpcClient inited");
      localObject3 = k.c();
      ((k)localObject3).a((com.taobao.txc.a.a.b)localObject2);
      ((k)localObject3).a(new f());
      ((k)localObject3).d();
      b.info("TxcResourceManager inited");
      localObject1 = new j();
      ((j)localObject1).a((com.taobao.txc.resourcemanager.a)localObject2);
      ((j)localObject1).a((com.taobao.txc.resourcemanager.b)localObject3);
      ((j)localObject1).a();
      b.info("AT TxcRMMessageListener inited");
    }
    if ((0x2 & paramInt1) > 0)
    {
      localObject2 = com.taobao.txc.resourcemanager.mt.c.b(this.a);
      ((com.taobao.txc.resourcemanager.mt.c)localObject2).d(paramString1);
      ((com.taobao.txc.resourcemanager.mt.c)localObject2).b();
      b.info("MtRmRpcClient inited");
      localObject3 = MtResourceManager.getTxcResourceManager();
      ((MtResourceManager)localObject3).a((com.taobao.txc.a.a.b)localObject2);
      ((MtResourceManager)localObject3).c();
      b.info("MtResourceManager inited");
      if (localObject1 == null) {
        localObject1 = new j();
      }
      ((j)localObject1).b((com.taobao.txc.resourcemanager.a)localObject2);
      ((j)localObject1).a((MtResourceManager)localObject3);
      ((j)localObject1).a();
      b.info("MT TxcRMMessageListener inited");
    }
  }
  
  public com.taobao.txc.client.a.a a()
  {
    return this.f;
  }
  
  public String b()
  {
    if ((this.d == null) || (this.d.isEmpty())) {
      this.d = System.getProperty("txc.accesskey");
    }
    return this.d;
  }
  
  public String c()
  {
    if ((this.e == null) || (this.e.isEmpty())) {
      this.e = System.getProperty("txc.secretkey");
    }
    return this.e;
  }
}


/* Location:           C:\Users\ibm\Downloads\txc-yun-sample (1)\txc-yun-sample\lib\txc-client-2.0.72.jar
 * Qualified Name:     com.taobao.txc.client.a
 * JD-Core Version:    0.7.0.1
 */